﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            Marker.MarkerVersion();

            Marker expoMarker = Marker.CreateMarker();
            expoMarker.Color = "Black";
            expoMarker.Length = 12;
            expoMarker.Type = MarkerType.DryErase;
            expoMarker.Cost = 2.99m;

            Console.WriteLine(expoMarker.MarkerDescription);

            for (int i = 0; i <= 12; i++ )
            {
                expoMarker.Write("Rockets play soon!");
                expoMarker.CheckInkLevel();
            }
            Console.ReadLine();
        }
    }

    public class Marker
    {
        #region Class Instance Variables

        private int _inkLevel;

        #endregion
        public static void MarkerVersion()
        {
            Console.WriteLine("v1.0");
        }

        public static Marker CreateMarker()
        {
            return new Marker();
        }

        #region Properties

        private string _color;
        public string Color
        {
            get { return _color; }
            set 
            {
                _color = value.ToLower(); 
            }
        }

        public MarkerType Type { get; set; }
        public int Length { get; set; }
        public decimal Cost {get; set; }
        public string MarkerDescription 
        { 
            get
            {
                return string.Format("Type: {0}, Color: {1}, Length: {2}, Cost: {3}", 
                    this.Type, this.Color, this.Length, this.Cost.ToString("C"));
            }
        }

        #endregion

        public Marker()
        {
            _inkLevel = 100;
        }

        #region Instance Methods

        public void Write(string message)
        {
            if (_inkLevel <= 0)
            {
                Console.WriteLine("Sorry this marker is out of ink!");
            }
            else
            {
                _inkLevel -= 10;
                Console.WriteLine("Writing " + message);
            }            
        }

        public void CheckInkLevel()
        {
            Console.WriteLine("Ink Level at " + _inkLevel);
        }

        #endregion
    }



    public enum MarkerType
    {
        DryErase,
        Permanent
    }
}
